﻿@model GameCode.Models.Admin.ArticleModel
@{
    ViewBag.Title = string.Format("游戏特权 - {0}",Model.Caption);
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
<link href="@Url.Content("~/Scripts/ueditor/themes/default/ueditor.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/ueditor/editor_config.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/ueditor/editor_ui_all_min.js")" type="text/javascript"></script>
<script type="text/javascript">
    var editor;
    var hasRun = false;
    var i = 0;
    $(document).live('pageshow', function (event, ui) {
        i++;
        var isReturn = $(".isReturn").val();
        if (isReturn == 'true' && i == 1) {
            return;
        }
        if (hasRun) {
            return;
        }
        $('#editor').hide();

        editor = new baidu.editor.ui.Editor({
            UEDITOR_HOME_URL: '../../Scripts/ueditor/',
            iframeCssUrl: '../../Scripts/ueditor/themes/default/iframe.css',
            autoClearinitialContent: true,
            initialContent: '<span style="color:#ccc">请输入内容</span>',
            elementPathEnabled: false,
            minFrameHeight: 400
        });
        editor.render('editor');
        if ($(".content").attr("value") != "") {
            var str = $(".content").attr("value");
            editor.setContent(str);
        }


        $('#editor').show();
        hasRun = true;
    });
    function sumbit() {
        $(".content").attr("value", editor.getContent());
        $("form").submit();
    }
</script>
@using (Html.BeginForm(new { act = "submit" }))
{
    @Html.HiddenFor(m => m.Type)
    <div class="ui-bar ui-bar-a">
        编辑
    </div>
    <div class="ui-body ui-body-a">
        @Html.HiddenFor(m => m.Content, new { @class = "content" })
        <div data-role="fieldcontain">
            <div id='editor'>
            </div>
        </div>
        <input type="button" value="确认" data-inline="true" data-mini="true" onclick="sumbit()" />
    </div>
}